package com.szpx.service.impl;

import com.szpx.entity.settingentity.SiteSetting;
import com.szpx.mapper.SiteSettingMapper;
import com.szpx.service.SettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional //事务处理策略
public class SettingServiceImpl implements SettingsService {

    @Autowired
    private SiteSettingMapper siteSettingMapper;

    /**
     * 查询所有站点信息
     * @return
     */
    @Override
    public List<SiteSetting> selectAll() {
        return siteSettingMapper.selectAll();



    }

    /**
     * 新增站点
     * @param siteSetting
     * @return
     */
    @Override
    public int add(SiteSetting siteSetting) {
        return siteSettingMapper.insert(siteSetting);
    }

    /**
     * 删除站点
     * @param id
     * @return
     */
    @Override
    public int delete(Integer id) {
        return siteSettingMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int update(SiteSetting siteSetting) {
        return siteSettingMapper.updateByPrimaryKeySelective(siteSetting);
    }
}
